package com.zzj.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzj.entity.CommentRoot;
import com.zzj.mapper.CommentRootMapper;
import com.zzj.model.dto.comment.CommentListDTO;
import com.zzj.model.vo.CommentVo;
import com.zzj.service.ICommentRootService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zzj
 * @since 2023-05-13
 */
@Service
public class CommentRootServiceImpl extends ServiceImpl<CommentRootMapper, CommentRoot> implements ICommentRootService {

    @Override
    public IPage<CommentVo> commentVoList(Page<?> page, CommentListDTO in) {
        return this.baseMapper.commentVoList(page, in);
    }

    @Override
    public CommentVo id(int rootId) {
        return this.baseMapper.id(rootId);
    }

    @Override
    public CommentRoot findCommentRoot(int id) {
        return this.getOne(Wrappers.<CommentRoot>lambdaQuery()
                .eq(CommentRoot::getId, id));

    }
}
